#pragma once

#include <math.h>



class _GraphCoordinateController
{

public:
	_GraphCoordinateController(void);
	~_GraphCoordinateController(void);

	/**
	* Get and set min and max values
	*
	* @param min the minimum data point on the axis
	* @param max the maximum data point on the axis
	*/
	void _GraphCoordinateController::getMinMaxCoordinates(double* XMin, double* XMax, double* YMin, double* YMax);
	void _GraphCoordinateController::setMinMaxCoordinates(double XMin, double XMax, double YMin, double YMax);

	/**
	* Instantiates a new instance of the NiceScale class.
	*
	* @param min the minimum data point on the axis
	* @param max the maximum data point on the axis
	*/
	void NiceScale(double min, double max);

	/**
	* Calculate and update values for tick spacing and nice
	* minimum and maximum data points on the axis.
	*/
	void calculate();

	/**
	* Returns a "nice" number approximately equal to range Rounds
	* the number if round = true Takes the ceiling if round = false.
	*
	* @param range the data range
	* @param round whether to round the result
	* @return a "nice" number to be used for the data range
	*/
	double niceNum(double range, bool round);

	/**
	* Sets the minimum and maximum data points for the axis.
	*
	* @param minPoint the minimum data point on the axis
	* @param maxPoint the maximum data point on the axis
	*/
	void setMinMaxPoints(double minPoint, double maxPoint) ;

	/**
	* Sets maximum number of tick marks we're comfortable with
	*
	* @param maxTicks the maximum number of tick marks for the axis
	*/
	void setMaxTicks(double maxTicks) ;

	/**
	* Gets the tick spacing.
	*
	* @return the tick spacing
	*/
	double getTickSpacing() ;

	/**
	* Gets the "nice" minimum data point.
	*
	* @return the new minimum data point for the axis scale
	*/
	double getNiceMin() ;

	/**
	* Gets the "nice" maximum data point.
	*
	* @return the new maximum data point for the axis scale
	*/
	double getNiceMax() ;

	/**
	* Test if double is equal up to a specific precision.
	*
	* @param min the minimum data point on the axis
	* @param max the maximum data point on the axis
	*/
	bool isEqualUpToPrecision(double x1, double x2, unsigned int Precision);

private:
	double minPoint;
	double maxPoint;
	double maxTicks;
	double tickSpacing;
	double range;
	double niceMin;
	double niceMax;
	double m_MinX;
	double m_MaxX;
	double m_MinY;
	double m_MaxY;


};

